

#ifndef __RAMP_H__
#define __RAMP_H__

#ifdef RAMP_H_GLOBAL
  #define RAMP_H_EXTERN 
#else
  #define RAMP_H_EXTERN extern
#endif

#include "stdint.h"

typedef struct ramp_t
{
  int32_t count;
  int32_t scale;
  float   out;
  void  (*init)(struct ramp_t *ramp, int32_t scale);
  float (*calc)(struct ramp_t *ramp);
}ramp_t;

#define RAMP_GEN_DAFAULT     \
  {                          \
    .count = 0,              \
    .scale = 0,              \
    .out = 0,                \
    .init = &ramp_init,      \
    .calc = &ramp_calculate, \
  }

void  ramp_init(ramp_t *ramp, int32_t scale);
float ramp_calculate(ramp_t *ramp);

#endif // __RAMP_H__

